/* @All Right Reserved (C), 2013-2015*/

//! 
/*!
 \author   : 
 \date     : 2013/05/19 17:38
 \version  : ver x.x
 \filename : SmartDockItem.h
 \note     : 
        
 \attention: 
        
 \remark   : 
 \History:
   <author>      <time>      <version>         <desc>
*/

#ifndef SMART_DOCK_ITEM_H
#define SMART_DOCK_ITEM_H

#include <QPushButton>
#include <QWidget>
#include <QString>
#include <QLabel>

class PreviewWidget : public QWidget{
	Q_OBJECT
public:
	//PreviewWidget();
	PreviewWidget(QWidget *parent = 0, Qt::WFlags flags = 0);
	virtual ~PreviewWidget();

	void SetIcon(QIcon* icon);
	void SetTitle(QString title);
	void SetImage(QPixmap* pixmap);

protected:
	virtual void paintEvent(QPaintEvent *e);
	virtual void enterEvent(QEvent *ev);
	virtual void leaveEvent(QEvent *ev);
    void resizeEvent(QResizeEvent *ev);

private:
	QLabel* m_icon;
	QLabel* m_title;
	QPushButton* m_close;
	QLabel* m_preview;
};

class QPixmap;
class SmartDockItem : public QPushButton{
	Q_OBJECT
public:
	SmartDockItem (QWidget *parent = 0);
	SmartDockItem ( const QString & text, QWidget * parent = 0 );
	virtual ~SmartDockItem ();

	void SetPixmap (QPixmap* pm);

Q_SIGNALS:
		void hovered(SmartDockItem*);

protected:
	virtual void enterEvent(QEvent * ev);
	virtual void leaveEvent(QEvent * ev);

	virtual void mouseMoveEvent(QMouseEvent *e);

private:
	PreviewWidget* m_showWidget;
	bool m_bLeave;
	bool m_stayInShowWidget;
};

#endif